package com.jpyl.jpMedicalTreatment.view.widget;

import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Bitmap;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.jpyl.jpMedicalTreatment.R;
import com.jpyl.jpMedicalTreatment.util.QRCodeUtil;

/**
 * Created by dongbinbin on 2015/9/14.
 */
public class MineScanDialog extends Dialog {

    public MineScanDialog(Context context, int theme) {
        super(context, theme);
    }

    public static class Builder {

        private Context context;
        private Bitmap myBitmap;

        public Builder(Context context) {
            this.context = context;
        }

        public Builder setMessage(Bitmap myBitmap) {
            this.myBitmap = myBitmap;
            return this;
        }

        @SuppressLint("InflateParams")
        public MineScanDialog create() {
            LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            final MineScanDialog dialog = new MineScanDialog(context, R.style.MedicalDialog);
            View layout = inflater.inflate(R.layout.dialog_mine_scan_layout, null);
            ((ImageView) layout.findViewById(R.id.mine_scan_view)).setImageBitmap(myBitmap);
            ((RelativeLayout) layout.findViewById(R.id.setup_dialog_layout)).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    dialog.dismiss();
                }
            });
            dialog.setContentView(layout);
            return dialog;
        }
    }
}
